package com.mud.mudcommune.view.fragment.twoLevel;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.mud.mudcommune.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * A simple {@link Fragment} subclass.
 */
public class AboutUsFragment extends Fragment {
    public static Fragment fragment = new AboutUsFragment();
    @BindView(R.id.webView_AboutUs)
    WebView webView;
    @BindView(R.id.head_title)
    TextView title;
    @BindView(R.id.case_back)
    ImageView back;

    public static Fragment getInstance() {
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_about_us, container, false);
        ButterKnife.bind(this, view);
        title.setText("关于我们");
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);//支持javascript
        webView.loadUrl("http://m.n8house.com/zt/n8hzhj/");
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
                view.loadUrl(url);//数据加载不出来
                return true;
            }
        });
        return view;
    }

    @OnClick({R.id.case_back})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.case_back:
                getFragmentManager().popBackStack();
                break;
        }
    }

}
